home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Eagles Nest BBS 8
/
Eagles_Nest_Mac_Collection_Disc_8.TOAST
/
Developer Tools⁄Additions
/
UFullTEView
/
UFullTEView.a
next >
Wrap
Text File
|
1990-10-18
|
6KB
|
238 lines
; This is part of the UFullTEView Version 2.3 package.
; See the Pascal units for more details.
SEG 'FullTERes'
include 'Traps.a'
include 'ToolEqu.a'
include 'QuickEqu.a'
; DoHigh takes care of highlighting text with mouse movement, avoiding the
; flashing that TESetSelect would produce.
DOHIGH PROC EXPORT
LINK A6,#0
MOVEM.L D3-D7/A2-A5,-(SP)
;12(A6) theTEPtr
;10(A6) starting offset
;8(A6) ending offset
MOVE.L 12(A6),A3
MOVE.W 10(A6),D3
MOVE.W 8(A6),D4
MOVE.W #1,D7
MOVE.L TEDoText,A0
JSR (A0)
MOVEM.L (SP)+,D3-D7/A2-A5
UNLK A6
MOVE.L (SP)+,A1
ADD.L #8,SP
JMP (A1)
ENDP
; These next two routines provide for a slanted cursor within italicized text…
DRAWHIGHPROC PROC EXPORT
IMPORT ISITALIC
LINK A6,#0
MOVEM.L D3-D7/A2-A6,-(SP)
MOVE.L 4(A6),A2 ;addr of selection's rectangle
MOVE.W left(A2),D3 ;D3 = topleft.h
MOVE.W D3,D4 ;D4 = bottomleft.h
MOVE.W right(A2),D6 ;D6 = topright.h
MOVE.W D6,D7 ;D7 = bottomright.h
CMP.W #-32700,D3
BLT.B TryRight ;Don't bother if -MAXINT
SUBQ.L #2,SP ;room for IsItalic's result
MOVE.W D4,-(SP)
MOVE.W bottom(A2),D5
ADD.W top(A2),D5
ASR.W #1,D5
MOVE.W D5,-(SP) ;half the height
MOVE.L A3,-(SP) ;TEPtr
JSR ISITALIC
MOVE.W (SP)+,D1 ;get result of IsItalic
BTST #8,D1
BZ.B TryRight ;0 = not italic
MOVE.W bottom(A2),D5 ;italic -> shift the top
SUB.W top(A2),D5
ASR.W #1,D5
ADD.W D5,D3
SUB.W #2,D3 ;and shift a bit leftward
SUB.W #2,D4
TryRight: CMP.W #32700,D6
BGT.B DrawHighlight ;Don't bother if MAXINT
SUBQ.L #2,SP ;room for IsItalic's result
MOVE.W D7,-(SP)
MOVE.W bottom(A2),D5
ADD.W top(A2),D5
ASR.W #1,D5
MOVE.W D5,-(SP) ;half the height
MOVE.L A3,-(SP) ;TEPtr
JSR ISITALIC
MOVE.W (SP)+,D1 ;get result of IsItalic
BTST #8,D1
BZ.B DrawHighlight ;0 = not italic
MOVE.W bottom(A2),D5 ;italic -> shift the top
SUB.W top(A2),D5
ASR.W #1,D5
ADD.W D5,D6
SUB.W #2,D6 ;and shift a bit leftward
SUB.W #2,D7
DrawHighlight SUBQ.L #4,SP ;room for result
_OpenPoly
MOVE.L (SP)+,A3 ;handle to Polygon
MOVE.W D4,-(SP)
MOVE.W bottom(A2),-(SP)
_MoveTo
MOVE.W D3,-(SP)
MOVE.W top(A2),-(SP)
_LineTo
MOVE.W D6,-(SP)
MOVE.W top(A2),-(SP)
_LineTo
MOVE.W D7,-(SP)
MOVE.W bottom(A2),-(SP)
_LineTo
_ClosePgon
MOVE.L A3,-(SP)
_InvertPoly
MOVE.L A3,-(SP)
_KillPoly
MOVEM.L (SP)+,D3-D7/A2-A6
UNLK A6
ADD.L #4,SP
RTS
ENDP
DRAWCARETPROC PROC EXPORT
IMPORT ISITALIC
LINK A6,#0
MOVEM.L D3-D7/A2-A6,-(SP)
MOVE.L 4(A6),A2 ;addr of caret's rectangle
MOVE.W left(A2),D3 ;D3 = topleft.h
MOVE.W D3,D4 ;D4 = bottomleft.h
SUBQ.L #2,SP ;room for IsItalic's result
MOVE.W D4,-(SP)
MOVE.W bottom(A2),D5
ADD.W top(A2),D5
ASR.W #1,D5
MOVE.W D5,-(SP) ;half the height
MOVE.L A3,-(SP) ;TEPtr
JSR ISITALIC
MOVE.W (SP)+,D1 ;get result of IsItalic
BTST #8,D1
BZ.B DrawCaret ;0 = not italic
MOVE.W bottom(A2),D5 ;italic -> shift the top
SUB.W top(A2),D5
ASR.W #1,D5
ADD.W D5,D3
SUB.W #2,D3 ;and shift a bit leftward
SUB.W #2,D4
DrawCaret SUBQ.L #4,SP ;room for result
_OpenPoly
MOVE.L (SP)+,A3 ;handle to Polygon
MOVE.W D4,-(SP)
MOVE.W bottom(A2),-(SP)
_MoveTo
MOVE.W D3,-(SP)
MOVE.W top(A2),-(SP)
_LineTo
MOVE.W #1,-(SP)
MOVE.W #0,-(SP)
_Line
ADDQ.W #1,D4
MOVE.W D4,-(SP)
MOVE.W bottom(A2),-(SP)
_LineTo
_ClosePgon
MOVE.L A3,-(SP)
_InvertPoly
MOVE.L A3,-(SP)
_KillPoly
MOVEM.L (SP)+,D3-D7/A2-A6
UNLK A6
ADD.L #4,SP
RTS
ENDP
; The following form the glue for using the sub/superscript options of
; UFullTEView. You do not need to include these if you have set SubSuper to
; FALSE in UFullTEView.p.
SUBSUPERDRAWGLUE PROC EXPORT
IMPORT NEWDRAWPROC
MOVEM.L D0-D7/A0-A6,-(SP)
MOVE.W D0,-(SP) ;starting offset
MOVE.W D1,-(SP) ;length
MOVE.L A0,-(SP) ;pointer to text
MOVE.L A3,-(SP) ;TEPtr
MOVE.L A4,-(SP) ;TEHandle
JSR NEWDRAWPROC
MOVEM.L (SP)+,D0-D7/A0-A6
RTS
ENDP
OLDDRAWPROC PROC EXPORT
LINK A6,#0
MOVEM.L D3-D7/A2-A5,-(SP)
;8(A6) theTEHdl
;12(A6) theTEPtr
;16(A6) theText
;20(A6) length
;22(A6) theStart
;24(A6) previousDrawProc
; First set up registers for another custom DrawHook
MOVE.W 22(A6),D0
MOVE.W 20(A6),D1
MOVE.L 16(A6),A0
MOVE.L 12(A6),A3
MOVE.L 8(A6),A4
MOVE.L SP,A4 ;save SP
; Now push parameters (in case Previous is DrawText)
MOVE.L 16(A6),-(SP)
MOVE.W 22(A6),-(SP)
MOVE.W 20(A6),-(SP)
; Call the previous Drawing proc
MOVE.L 24(A6),A1
JSR (A1)
MOVE.L A4,SP ;restore SP (in case Previous is not DrawText)
MOVEM.L (SP)+,D3-D7/A2-A5
UNLK A6
MOVE.L (SP)+,A1
ADD.L #20,SP
JMP (A1)
ENDP
END